# -*- coding: utf-8 -*-
import socket
host='0.0.0.0'
port=847
xml='<?xml version="1.0"?><cross-domain-policy> \
  <site-control permitted-cross-domain-policies="all"/> \
  <allow-access-from domain="" to-ports=""/>\
  <allow-http-request-headers-from domain="" headers=""/>\
  </cross-domain-policy>'

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((host,port))
s.listen(2)
try:
  while True:
    conn,addr=s.accept()
    while True:
      data=conn.recv(1024)
      print(data)
      if data=='exit' or not data:
        break
      conn.send(xml.encode(encoding="utf-8"))
      print("send end")

except KeyboardInterrupt:
  print("you have CTRL+C,Now quit")
  s.close()


